package cn.chaohi.controller.model.versionConfig;

import cn.chaohi.domain.config.AllUpgradeConfig;
import cn.chaohi.domain.config.PartUpgradeConfig;
import cn.chaohi.domain.version.AllVersionInfo;
import cn.chaohi.domain.version.PlusVersionInfo;

public class ConfigAndVersionResp {

	// 版本号
	private String version;
	// 全部升级（1全部 -1部分）
	private String allUpgrade;
	// 是否全量升级（1全量 -1增量 ）
	private String plusUpgrade;
	// 是否后台下载（1后台 -1前台 ）
	private String backDownload;
	// 1：关闭 2:升级 3：降级
	private String upgradeDegrade;
	// 是否可取消升级（1可取消 -1不可取消）
	private String cancelUpgrade;
	// 1：暂不升级 2：无用户使用时升级 3：立刻升级 4：取消下载
	private String upgradeStrategy;
	// 1:无用户使用自动下载 2:立即下载
	private String downloadStrategy;
	// md5摘要，用于确保下载是否成功
	private String mad5Value;
	// 下载url
	private String downLoadURL;

	// 全部-全量 升级
	public ConfigAndVersionResp(AllUpgradeConfig allUpgradeConfig, AllVersionInfo allVersionInfo) {
		this.version = allUpgradeConfig.getVersion();
		this.allUpgrade = allUpgradeConfig.getAllUpgrade();
		this.plusUpgrade = allUpgradeConfig.getPlusUpgrade();
		this.backDownload = allUpgradeConfig.getBackDownload();
		this.upgradeDegrade = allUpgradeConfig.getUpgradeDegrade();
		this.cancelUpgrade = allUpgradeConfig.getCancelUpgrade();
		this.upgradeStrategy = allUpgradeConfig.getUpgradeStrategy();
		this.downloadStrategy = allUpgradeConfig.getDownloadStrategy();
		this.mad5Value = allVersionInfo.getMad5Value();
		this.downLoadURL = allVersionInfo.getAllURL();
	}

	// 全部-增量 升级
	public ConfigAndVersionResp(AllUpgradeConfig allUpgradeConfig, PlusVersionInfo allVersionInfo) {
		this.version = allUpgradeConfig.getVersion();
		this.allUpgrade = allUpgradeConfig.getAllUpgrade();
		this.plusUpgrade = allUpgradeConfig.getPlusUpgrade();
		this.backDownload = allUpgradeConfig.getBackDownload();
		this.upgradeDegrade = allUpgradeConfig.getUpgradeDegrade();
		this.cancelUpgrade = allUpgradeConfig.getCancelUpgrade();
		this.upgradeStrategy = allUpgradeConfig.getUpgradeStrategy();
		this.downloadStrategy = allUpgradeConfig.getDownloadStrategy();
		this.mad5Value = allVersionInfo.getMad5Value();
		this.downLoadURL = allVersionInfo.getPlusURL();
	}

	// 部分-全量 升级
	public ConfigAndVersionResp(PartUpgradeConfig partUpgradeConfig, AllVersionInfo allVersionInfo) {
		this.version = partUpgradeConfig.getVersion();
		this.allUpgrade = "-1";
		this.plusUpgrade = partUpgradeConfig.getPlusUpgrade();
		this.backDownload = partUpgradeConfig.getBackDownload();
		this.upgradeDegrade = partUpgradeConfig.getUpgradeDegrade();
		this.cancelUpgrade = partUpgradeConfig.getCancelUpgrade();
		this.upgradeStrategy = partUpgradeConfig.getUpgradeStrategy();
		this.downloadStrategy = partUpgradeConfig.getDownloadStrategy();
		this.mad5Value = allVersionInfo.getMad5Value();
		this.downLoadURL = allVersionInfo.getAllURL();
	}

	// 部分-增量 升级
	public ConfigAndVersionResp(PartUpgradeConfig partUpgradeConfig, PlusVersionInfo allVersionInfo) {
		this.version = partUpgradeConfig.getVersion();
		this.allUpgrade = "-1";
		this.plusUpgrade = partUpgradeConfig.getPlusUpgrade();
		this.backDownload = partUpgradeConfig.getBackDownload();
		this.upgradeDegrade = partUpgradeConfig.getUpgradeDegrade();
		this.cancelUpgrade = partUpgradeConfig.getCancelUpgrade();
		this.upgradeStrategy = partUpgradeConfig.getUpgradeStrategy();
		this.downloadStrategy = partUpgradeConfig.getDownloadStrategy();
		this.mad5Value = allVersionInfo.getMad5Value();
		this.downLoadURL = allVersionInfo.getPlusURL();
	}
	
	public ConfigAndVersionResp(AllUpgradeConfig allUpgradeConfig) {
		this.version = "";
		this.allUpgrade = allUpgradeConfig.getAllUpgrade();
		this.plusUpgrade = allUpgradeConfig.getPlusUpgrade();
		this.backDownload = allUpgradeConfig.getBackDownload();
		this.upgradeDegrade = allUpgradeConfig.getUpgradeDegrade();
		this.cancelUpgrade = allUpgradeConfig.getCancelUpgrade();
		this.upgradeStrategy = allUpgradeConfig.getUpgradeStrategy();
		this.downloadStrategy = allUpgradeConfig.getDownloadStrategy();
		this.mad5Value = "";
		this.downLoadURL = "";
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public String getAllUpgrade() {
		return allUpgrade;
	}

	public void setAllUpgrade(String allUpgrade) {
		this.allUpgrade = allUpgrade;
	}

	public String getPlusUpgrade() {
		return plusUpgrade;
	}

	public void setPlusUpgrade(String plusUpgrade) {
		this.plusUpgrade = plusUpgrade;
	}

	public String getBackDownload() {
		return backDownload;
	}

	public void setBackDownload(String backDownload) {
		this.backDownload = backDownload;
	}

	public String getUpgradeDegrade() {
		return upgradeDegrade;
	}

	public void setUpgradeDegrade(String upgradeDegrade) {
		this.upgradeDegrade = upgradeDegrade;
	}

	public String getCancelUpgrade() {
		return cancelUpgrade;
	}

	public void setCancelUpgrade(String cancelUpgrade) {
		this.cancelUpgrade = cancelUpgrade;
	}

	public String getUpgradeStrategy() {
		return upgradeStrategy;
	}

	public void setUpgradeStrategy(String upgradeStrategy) {
		this.upgradeStrategy = upgradeStrategy;
	}

	public String getDownloadStrategy() {
		return downloadStrategy;
	}

	public void setDownloadStrategy(String downloadStrategy) {
		this.downloadStrategy = downloadStrategy;
	}

	public String getMad5Value() {
		return mad5Value;
	}

	public void setMad5Value(String mad5Value) {
		this.mad5Value = mad5Value;
	}

	public String getDownLoadURL() {
		return downLoadURL;
	}

	public void setDownLoadURL(String downLoadURL) {
		this.downLoadURL = downLoadURL;
	}

	public ConfigAndVersionResp() {
		super();
	}
}
